home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / oper_sys / oasis / ossxmpls.lha / examples / tak.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-03-25  |  261 b   |  20 lines

  1. /* C version of tak benchmark */
  2.  
  3. #include <stdio.h>
  4.  
  5. int tak(x,y,z)
  6. int x, y, z;
  7. {
  8.   int a1, a2, a3;
  9.   if (x <= y) return z;
  10.   a1 = tak(x-1,y,z);
  11.   a2 = tak(y-1,z,x);
  12.   a3 = tak(z-1,x,y);
  13.   return tak(a1,a2,a3);
  14. }
  15.  
  16. main()
  17. {
  18.   printf("%d\n", tak(24, 16, 8));
  19. }
  20.